<{include file="public/header.html"}>

<script type="text/javascript" src="<{$VIRT_JSCRIPT}>/jqtreetable.js"></script>
<style type="text/css">
    .btn_expmenu {background-image:url('<{$VIRT_IMAGES}>/btn/list-items.gif') !important;}
    .btn_exphtml {background-image:url('<{$VIRT_IMAGES}>/btn/f_html.png') !important;}
    .btn_exppdf  {background-image:url('<{$VIRT_IMAGES}>/btn/f_pdf.png') !important;}
    .btn_expxls  {background-image:url('<{$VIRT_IMAGES}>/btn/f_excel.png') !important;}

/*jqtree css*/
.collapsed { display: none; }
.tablemain {
    font-size:12px;
    border:1px solid #cad9ea;
    empty-cells:show; 
    border-collapse:collapse;
    margin:0 auto;
}
.tablemain th {
    background-image: url('<{$VIRT_IMAGES}>/pub/th_bg.gif');
    background-repeat::repeat-x;
    border:1px solid #cad9ea;
    padding:1;
    height:25px;
}

.tablemain td {
    height:20px;
    border:1px solid #cad9ea;
    padding:1;
}
#treeBody {background-color:#f5fafe;}

.adeimg, .ttimage, .parimg, .preimg { 
    border: none; margin: 0px; padding: 0px; vertical-align: bottom; width: 16px; height: 16px; 
}
.adeimg, .parimg {cursor: pointer; }
.even { background-color: #FFF; }
.over { background-color: #AEF; } <!-- mouse over background color #69f of table row -->

</style>

<div id="treeTable">
<table width="100%"  border="1" class="tablemain">
<thead><tr>
    <th title="任务号" align="center"><b>#</b></th>
    <th title="优先级" align="center"><b>!</b></th>
    <th title="任务名称">任务名称</th>
    <th title="工期(工作日或小时)" align="center">工期</th>
    <th title="计划开始时间" align="center">计划开始时间</th>
    <th title="计划结束时间" align="center">计划结束时间</th>
    <th title="前置任务">前置任务</th>
    <th title="资源名称">资源名称</th>
    <th title="已完成百分比" align="right">已完成%</th>
    <th title="实际开始时间" align="center">实际开始时间</th>
    <th title="实际结束时间" align="center">实际结束时间</th>
    <th title="限制类型">限制类型</th>
    <th title="限制日期" align="center">限制日期</th>
</tr></thead>
<tbody id="treeBody">
<{ section name="sIndex" loop=$aTask }>
<tr>
    <td align="center"> <{ $aTask[sIndex].sNumb }> </td>
    <td align="center">
<{ if $aTask[sIndex].sPri eq 1 }>
    <font color='red'>高</font>
<{ elseif $aTask[sIndex].sPri eq 3 }>
    <font color='green'>低</font>
<{ else }> 中  <{ /if }></td>
    <td><a href="javascript:showTask(<{ $aTask[sIndex].sID }>);">
    <{ $aTask[sIndex].sName }> <{ if $aTask[sIndex].isMst eq 1 }> &loz; <{ /if }> </a></td>
    <td align="right"><{ $aTask[sIndex].sDur }> <{ if $aTask[sIndex].isEst eq 1 }> ? <{ else }> &nbsp;<{ /if }></td>
    <td align="center"><{ $aTask[sIndex].sPSD }></td>
    <td align="center"><{ $aTask[sIndex].sPFD }></td>
    <td><{ $aTask[sIndex].preTask }></td>
    <td><{ $aTask[sIndex].sRes }></td>
    <td align="right"><{ $aTask[sIndex].sFP }></td>
    <td align="center"><{ $aTask[sIndex].sFSD }></td>
    <td align="center"><{ $aTask[sIndex].sFFD }></td>
    <td><{ $aTask[sIndex].sLType }></td>
    <td align="center"><{ $aTask[sIndex].sLDate }></td>
</tr>
<{ /section }>
</tbody>
</table>
</div>

<script language="javascript">
<!--
//任务计划明细
if (Ext.form.ComboBox) {
    Ext.apply(Ext.form.ComboBox.prototype, {
        triggerAction:'all',
        selectOnFocus:true,
        editable:false,
        mode:'local',
        lazyInit:false,
        valueField:'sValue',
        displayField:'sText'
    });
}

var expMenu = new Ext.menu.Menu({
	id:'exportMenu',
	items:[
		{id:'htmlExp',text:"HTML导出",tooltip:'将项目导出保存成HTML文件',iconCls:'btn_exphtml'},
		{id:'pdfExp',text:"PDF导出",tooltip:'将项目导出保存成PDF文件',iconCls:'btn_exppdf'},
		{id:'xlsExp',text:"Excel导出",tooltip:'将项目导出保存成EXCEL文件',iconCls:'btn_expxls'}]
});


function loadProject(comb,record,index) {
    var projId=record.get("sValue");
    if (projId > 0) {
        window.location.href = "./taskList.php?strProjectID="+projId;
    }
}
function showTask(taskId) {
    if (taskId > 0) {
        var url = "task/taskinfo.php?strTaskID="+taskId;
        TabUtil.openTab("taskinfo","查看项目任务信息",url);
    }
}

var gridTask = new Ext.Panel({
    //frame:true,
    border:false,
    region:'center',
    contentEl:'treeTable',
    tbar:['项目列表:',
    {xtype:"combo",id:'sProjectID',emptyText:"请先选择项目",width:200,
        displayField:'sText',valueField:'sValue',value:'<{ $sProjectID }>',
        listeners:{'select':loadProject},
        store:new Ext.data.SimpleStore({
            data  :<{ $sProjectList }>,
            fields:['sValue','sText']
        })
    }, {
        text:'刷新任务明细',
        tooltip:'重新加载任务计划明细的数据',
        iconCls:'btn_refresh',
        handler:function() {window.location.reload();}
    }, '-', {
        id:"btnGantt",
        text:'查看甘特图',
        tooltip:'查看项目任务计划的甘特图',
        icon:_CONTEXT_PATH+'images/btn/query_win.gif',
        cls:"x-btn-text-icon",
        handler:function() {
            if (Ext.getCmp("sProjectID").getValue() == "") {
                Ext.Msg.alert('消息提醒', '请先从项目列表中选择一个项目');
            } else {
                TabUtil.openTab("gantt","查看甘特图","task/showGantt.php");
            }
        }
    }, '-', {
        id:"btnEdit",
        text:'编辑任务计划',
        tooltip:'编辑项目的任务计划明细',
        icon:_CONTEXT_PATH+'images/btn/edit.gif',
        cls:"x-btn-text-icon",
        handler:function() {
            if (Ext.getCmp("sProjectID").getValue() == "") {
                Ext.Msg.alert('消息提醒', '请先从项目列表中选择一个项目');
            } else {
                TabUtil.openTab("task","编辑项目任务计划","task/task.php");
            }
        }
    },'-',{text:'项目导出',iconCls:'btn_expmenu',menu:expMenu}]
});

var viewport = new Ext.Viewport({
    layout: 'border',
    items : gridTask
});

//-->
</script>
<script type="text/javascript">
<!--
$(function(){//Initialise the treetable
var treemap=<{$treeMap}>;
var imgpath="<{$VIRT_JSCRIPT}>/ext/resources/images/default/tree/";
var treeOptions = {openImg: imgpath+"folder-open.gif", shutImg: imgpath+"folder.gif", leafImg: imgpath+"leaf.gif", 
        lastOpenImg: imgpath+"folder-open.gif",lastShutImg: imgpath+"folder.gif", lastLeafImg: imgpath+"leaf.gif", 
        vertLineImg: imgpath+"elbow-end.gif", blankImg: imgpath+"elbow-line.gif", 
        collapse: false, column: 2, striped:true, highlight:true, state:false};
$("#treeBody").jqTreeTable(treemap, treeOptions);

});
//-->
</script>

<{include file="public/footer.html"}>